<%@page import="cn.edu.pku.wxlib.usertobookborrow.model.*"%>

<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib tagdir="/WEB-INF/tags/simpletable" prefix="simpletable"%>
<%@ include file="/commons/taglibs.jsp"%>

<rapid:override name="head">
	<title>图书信息维护</title>
	<script src='${ctx}/scripts/js.js'>  </script>
	<script src="${ctx}/scripts/rest.js"></script>
	<link href="<c:url value="/widgets/simpletable/simpletable.css"/>"
		type="text/css" rel="stylesheet">
	<script type="text/javascript"
		src="<c:url value="/widgets/simpletable/simpletable.js"/>"></script>

	<script type="text/javascript">
		$(document).ready(function() {
			window.simpleTable = new SimpleTable('queryForm',${page.thisPageNumber},${page.pageSize},'${pageRequest.sortColumns}');
		});
	</script>
</rapid:override>

<rapid:override name="content">
	<form action="${ctx }/book/search" id="queryForm" name="queryForm"
		method="post" style="display: block;">
		<div class="search">
			<div class="form-group inline icon">
				<i class="icon-reorder"></i> <input type="text"
					class="form-field col-2" id="bookName" name="bookName"
					placeholder="输入图书名称">
			</div>

			<div class="form-group inline icon">
				<i class="icon-pencil"></i> <input type="text"
					class="form-field col-2" id="author" name="author"
					placeholder="输入作者">
			</div>

			<div class="form-group inline icon">
				<i class="icon-pencil"></i> <input type="text"
					class="form-field col-2" id="author" name="translator"
					placeholder="输入译者" value="${query.translator }">
			</div>
			<div class="form-group inline icon">
				<i class="icon-bookmark"></i> <input type="text"
					class="form-field col-2" id="author" name="categoryId"
					placeholder="输入图书分类" value="${query.categoryId }" size="50px">
			</div>

			<div class="form-group inline icon search-btn"
				onclick="$('#queryForm').submit();" title="查询">
				<i class="icon-search"></i>
			</div>
			<!-- <input type="submit" value="查询"> -->

		</div>
	</form>

	<div class="handleControl">
		<div class="form-group inline">
			<button type="button" class="btn btn-primary"
				onclick="window.location = '${ctx}/book/new'" style="height: 35px;">新增图书</button>
		</div>
	</div>


	<div class="page" id="fullpage">
		<!-- start of book 1在借，2已还，3欠款，4丢失 -->
		<div class="orderlist">
			<table id="bookTable" class="table text-center" style="width: 100%"
				align="left">
				<!-- orderTable -->
				<thead>
					<tr>
						<th class="col0"><input type="checkbox" id='deletemanycb'
							name='deletemanycb' onclick='changegoodsIds()'>全选 <a
							href='javascript:deleteGoodsMany()'>删除</a></th>
						<th class="col3">图书名称</th>
						<th class="col0">馆藏总数</th>
						<th class="col0">可借复本</th>
						<th class="col3">详细信息</th>
						<th class="col3" colspan="4">操作</th>
					</tr>
				</thead>
				<tbody>
					<c:forEach items="${page.result}" var="item" varStatus="status">
						<tr>
							<td><input type="checkbox" name='goodsIds'
								value="${item.bookId}"></td>
							<td><c:out value='${item.bookName}' />&nbsp;</td>
							<td><c:out value='${item.storageTotalNumber}' />&nbsp;</td>
							<td><c:out value='${item.lendTotalNumber}' />&nbsp;</td>
							<td>ISBN：${item.isbn}&nbsp;&nbsp;&nbsp;
								作者：${item.author}&nbsp;&nbsp;&nbsp;
								译者：${item.translator}&nbsp;&nbsp;&nbsp;
								出版社：${item.publisher}&nbsp;&nbsp;&nbsp; 更多详细信息请点击查看...</td>
							<td class="col"><a href="${ctx}/book/${item.bookId}" class="operation">查看</a>&nbsp;&nbsp;
								<a href="${ctx}/book/${item.bookId}/edit" class="operation">修改</a>&nbsp;&nbsp; <a
								href="${ctx}/book/${item.bookId}"
								onclick="doRestDelete(this,'你确认删除?');return false;" class="operation">删除</a>&nbsp;&nbsp;<a
								href="${ctx}/booksku/${item.bookId}/query" class="operation">图书SKU详情</a>&nbsp;&nbsp;</td>
						</tr>
					</c:forEach>
				</tbody>
			</table>
			<simpletable:pageToolbar page="${page}">
			</simpletable:pageToolbar>
			<div id="pagination"></div>
		</div>
		<!-- end of table  -->
		<div align="center" style="font-size: 30px;">
			<c:if test="${empty page.result }">
				<p>没有查询到相关书籍，请您重新查询！！！</p>
			</c:if>
		</div>
	</div>

</rapid:override>
<%@ include file="base.jsp"%>
